package com.xiongwei.status;

/**
 * @author XiongWei
 * @date 2024/2/19
 */
public class DispensePrizeState implements State{

    private RaffleActivity raffleActivity;

    public DispensePrizeState(RaffleActivity raffleActivity) {
        this.raffleActivity = raffleActivity;
    }

    @Override
    public void deductPoint() {
        System.out.println("不能扣除积分");
    }

    @Override
    public Boolean raffle() {
        System.out.println("不能抽奖");
        return false;
    }

    @Override
    public void dispensePrize() {
        if (raffleActivity.getCount() > 0) {
            System.out.println("还有奖品");
            //状态修改为不能抽奖
            raffleActivity.setState(raffleActivity.getNoRaffleState());
        } else {
            System.out.println("奖品发完啦");
            //状态修改为奖品发完
            raffleActivity.setState(raffleActivity.getDispensePrizeOutState());
        }
    }
}
